package cn.myframe.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;  

/**
 * 
 * 定时器配置
 * 
 * @author  ynz
 * @email   ynz@myframe.cn
 * @version 创建时间：2018年6月7日 上午9:48:41
 */
@Configuration 
public class QuartzConfigration {  
  
    /** 
     * attention: 
     * Details：定义quartz调度工厂 
     */  
    @Bean(name = "scheduler")  
    public SchedulerFactoryBean schedulerFactory() {  
    	  SchedulerFactoryBean bean = new SchedulerFactoryBean();  
          bean.setSchedulerName("Scheduler");
          
          // 用于quartz集群,QuartzScheduler 启动时更新己存在的Job  
          bean.setOverwriteExistingJobs(true);  
          // 延时启动，应用启动1秒后  
          bean.setStartupDelay(10);  
          // 注册触发器  
         // bean.setTriggers(cronJobTrigger);  
          return bean; 
    } 
}
